using System;
using System.Collections;

namespace PHSRAG.Insight21.Humans
{
	#region RexParams class
	/// <summary>
	/// RexParams contains answers to specific questions that need to be passed in to Rex 
	/// after a protocolProcess is submitted. 
	/// </summary>
	public class RexParams
	{
        

        #region Instance variables
        private int		subjectCount;
		private int		globalEnrollment;
		private bool	medicalRecords;
		private bool	humanMaterial;
		private bool	consentWaived;
		private bool	authorizationWaived;
		private bool	writtenConsentWaived;
		private bool	writtenAuthorizationWaived;
		private bool	patientAdvocateUsed;
		private char	expected;
		private int		medRecIdentifiers;
		private int		medRecDisclose;
		private int		humMatIdentifiers;
		private string	humMatDescription;
		private string  humMatOtherDescription;
		private string  subjectNumber;
		private string	sponsorAMENumber;
		private string  newProtocolTitle;
		private string  newProtocolVersion;
		private string	studyPopulationDescription;
		private string  aeReportType;
		private string	medSourceOther;
		private string  specConsidOther;
		private string  protocolTypeOverride;

		private DateTime humMatSurveyStart;
		private DateTime humMatSurveyEnd;
		private ArrayList drugs;
		private ArrayList devices;
		private ArrayList partnersSites;
		private ArrayList subjectTypes;
		private ArrayList keywords;
		private ArrayList studyTypes;
		private ArrayList remunerations;
		private ArrayList recruitment;
		private ArrayList componentsToChange;
		private ArrayList radiations;
		private ArrayList humanMatSources;
		private ArrayList crRaces;
		private ArrayList medRecSources;
		private ArrayList specialConsiderations;

		// continuing Review
		private string		crProjectStatus;
		private DateTime	crDateClosed;
		private int			crRecordsToDate;
		private int			crSpecimensToDate;

		// Adverse Event
		private string  aeGradeSeverity;
		private string  aeRelated;
		private DateTime aeDateOccurred;

		// Other Event
		private string		oeEventType;
		private	string		oeDescription;
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the number of subjects involved in the study
		/// </summary>
		public int SubjectCount
		{
			get { return subjectCount; }
			set { subjectCount = value; }
		}

		/// <summary>
		/// Gets or sets the global enrollment number
		/// </summary>
		public int GlobalEnrollment
		{
			get { return globalEnrollment; }
			set { globalEnrollment = value; }
		}

		/// <summary>
		/// Gets or sets whether MedicalRecords are involved.
		/// </summary>
		public bool	MedicalRecords
		{
			get { return medicalRecords; }
			set { medicalRecords = value; }
		}

		/// <summary>
		/// Gets or sets whether HumanMaterial are involved.
		/// </summary>
		public bool	HumanMaterial
		{
			get { return humanMaterial; }
			set { humanMaterial = value; }
		}

		/// <summary>
		/// ArrayList of any and all drugs associated with teh study
		/// </summary>
		public ArrayList Drugs
		{
			get { return drugs; } 
			set { drugs = value; }
		}

		/// <summary>
		/// ArrayList of any and all Devices associated with teh study
		/// </summary>
		public ArrayList Devices
		{
			get { return devices; } 
			set { devices = value; }
		}

		/// <summary>
		/// ArrayList of any and all PartnersSites associated with teh study
		/// </summary>
		public ArrayList PartnersSites
		{
			get { return partnersSites; } 
			set { partnersSites = value; }
		}

		/// <summary>
		/// array list of any and all subject types that will be used in teh study.
		/// </summary>
		public ArrayList SubjectTypes
		{
			get { return subjectTypes; }
			set { subjectTypes = value; }
		}

		/// <summary>
		/// List of keywords.
		/// </summary>
		public ArrayList Keywords
		{
			get { return keywords; }
			set { keywords = value; }
		}

		/// <summary>
		/// Whether or not consent has been waived for the protocol
		/// </summary>
		public bool ConsentWaived
		{
			get { return consentWaived; }
			set { consentWaived = value; }
		}

		/// <summary>
		/// if authorization has been waived ornot.
		/// </summary>
		public bool	AuthorizationWaived
		{
			get { return authorizationWaived; }
			set { authorizationWaived = value; }
		}

		/// <summary>
		/// if written consent has been waived or not for this protocol
		/// </summary>
		public bool	WrittenConsentWaived
		{
			get { return writtenConsentWaived; }
			set { writtenConsentWaived = value; }
		}

		/// <summary>
		/// if written authorization has been waived or not for this protocol
		/// </summary>
		public bool	WrittenAuthorizationWaived
		{
			get { return writtenAuthorizationWaived; }
			set { writtenAuthorizationWaived = value; }
		}

		/// <summary>
		/// if PatientAdvocacy is set or not for this protocol
		/// </summary>
		public bool	PatientAdvocateUsed
		{
			get { return patientAdvocateUsed; }
			set { patientAdvocateUsed = value; }
		}

		/// <summary>
		/// Pertains to an Adverse Event, whether or not the 
		/// AE was expected or not.
		/// </summary>
		public char Expected
		{
			get { return expected; }
			set { expected = value; }
		}

		/// <summary>
		/// Whether the medical record identifiers will be collected.
		/// </summary>
		public int MedRecIdentifiers
		{
			get { return medRecIdentifiers; }
			set { medRecIdentifiers = value; }
		}

		public int HumMatIdentifiers
		{
			get { return humMatIdentifiers; }
			set { humMatIdentifiers = value; }
		}

		public int MedRecDisclose
		{
			get { return medRecDisclose; }
			set { medRecDisclose = value; }
		}
		
		public string HumMatDescription
		{
			get { return humMatDescription; }
			set { humMatDescription = value; }
		}

		public string HumMatOtherDescription
		{
			get { return humMatOtherDescription; }
			set { humMatOtherDescription = value; }
		}

		/// <summary>
		/// Pertains to an Adverse event and other processes,
		/// determines which subject number the AE, etc. pertained to.
		/// </summary>
		public string SubjectNumber 
		{
			get { return subjectNumber; }
			set { subjectNumber = value; } 
		}
		
		/// <summary>
		/// Pertains to an Amendment process,
		/// it's tthe optional Sponsor AME #.
		/// </summary>
		public string SponsorAMENumber 
		{
			get { return sponsorAMENumber; }
			set { sponsorAMENumber = value; } 
		}

		/// <summary>
		/// The report type of the adverse event.
		/// </summary>
		public string AEReportType
		{
			get { return aeReportType; }
			set { aeReportType = value; }
		}


		/// <summary>
		/// The decription of the other event.
		/// </summary>
		public string MedSourceOther
		{
			get { return medSourceOther; }
			set { medSourceOther = value; }
		}

		/// <summary>
		/// Other value for special consideratiosn.
		/// </summary>
		public string SpecConsidOther
		{
			get { return specConsidOther; } 
			set { specConsidOther = value; }
		}

		/// <summary>
		/// For certain forms, we want to override the protocol type in Rex.
		/// </summary>
		public string ProtocolTypeOverride
		{
			get { return protocolTypeOverride; }
			set { protocolTypeOverride = value; }
		}

		/// <summary>
		/// the date an Adverse Event occurred.
		/// </summary>
		public DateTime AEDateOccurred
		{
			get { return aeDateOccurred; }
			set { aeDateOccurred = value; }
		}

		/// <summary>
		/// Adverse Event Relationship.
		/// </summary>
		public string AERelated
		{
			get { return aeRelated; }
			set { aeRelated = value; }
		}

		/// <summary>
		/// Adverse Event Grade/Severity.
		/// </summary>
		public string AEGradeSeverity
		{
			get { return aeGradeSeverity; }
			set { aeGradeSeverity = value; }
		}



		public DateTime HumMatSurveyStart
		{
			get { return humMatSurveyStart; }
			set { humMatSurveyStart = value; }
		}

		public DateTime HumMatSurveyEnd
		{
			get { return humMatSurveyEnd; }
			set { humMatSurveyEnd = value; }
		}

		/// <summary>
		/// In an amendment, you can change the title of the protocol. 
		/// This is used in the Approval script.
		/// </summary>
		public string NewProtocolTitle
		{
			get { return newProtocolTitle; }
			set { newProtocolTitle = value; }
		}

		/// <summary>
		/// In an amendment, you can change the Version / sponsor of the protocol. 
		/// This is used in the Approval script.
		/// </summary>
		public string  NewProtocolVersion
		{
			get { return newProtocolVersion; }
			set { newProtocolVersion = value; }
		}

		/// <summary>
		/// The description of the study population...
		/// </summary>
		public string StudyPopulationDescription
		{
			get { return studyPopulationDescription; }
			set { studyPopulationDescription = value; }
		}
		
		/// <summary>
		/// list of types of the study.
		/// </summary>
		public ArrayList StudyTypes
		{
			get { return studyTypes; }
			set { studyTypes = value; }
		}

		/// <summary>
		/// Collection of remunerations.
		/// </summary>
		public ArrayList Remunerations
		{
			get { return remunerations; }
			set { remunerations = value; }
		}
		#endregion

		/// <summary>
		/// collection of Recruitment types.
		/// </summary>
		public ArrayList Recruitment
		{
			get { return recruitment; }
			set { recruitment = value; }
		}

		/// <summary>
		/// Pertains to Amendments, determines which thing 
		/// will be changed in the amendment.
		/// </summary>
		public ArrayList ComponentsToChange
		{
			get { return componentsToChange; }
			set { componentsToChange = value; }
		}

		/// <summary>
		/// Human Material sources.
		/// </summary>
		public ArrayList HumanMaterialSources
		{
			get { return humanMatSources; }
			set { humanMatSources = value; }
		}

		/// <summary>
		/// Array list of medical record sources.
		/// </summary>
		public ArrayList MedicalRecordSources
		{
			get { return medRecSources; }
			set { medRecSources = value; }
		}

		/// <summary>
		/// Array of Special Considerations.
		/// </summary>
		public ArrayList SpecialConsiderations
		{
			get { return specialConsiderations; }
			set { specialConsiderations = value; }
		}

		/// <summary>
		/// Array list of ionizing and non-ionizing radiations
		/// </summary>
		public ArrayList Radiations
		{	
			get { return radiations; }
			set { radiations = value; }
		}

		/// <summary>
		/// Array list of CRRace objects representing the race
		/// population data in a continuing review.
		/// </summary>
		public ArrayList CRRaces
		{
			get { return crRaces; }
			set { crRaces = value; }
		}
		
		#region Constructors
		/// <summary>
		/// Default Constructor
		/// </summary>
		public RexParams()
		{

			specConsidOther = string.Empty;
			protocolTypeOverride = string.Empty;
			medSourceOther = string.Empty;
			aeReportType = string.Empty;
			humMatDescription = string.Empty;
			humMatOtherDescription = string.Empty;
			studyPopulationDescription = string.Empty;
			medicalRecords = false;
			humanMaterial = false;
			drugs = new ArrayList();
			devices = new ArrayList();
			partnersSites = new ArrayList();
			subjectTypes = new ArrayList();
			keywords	= new ArrayList();
			studyTypes	= new ArrayList();
			remunerations = new ArrayList();
			recruitment = new ArrayList();
			componentsToChange = new ArrayList();
			radiations = new ArrayList();
			humanMatSources = new ArrayList();
			medRecSources = new ArrayList();
			specialConsiderations = new ArrayList();
			humMatSurveyStart = DateTime.MinValue;
			humMatSurveyEnd = DateTime.MinValue;
			crProjectStatus = string.Empty;
			crDateClosed = DateTime.MinValue;
			crRaces = new ArrayList();
			newProtocolTitle = string.Empty;
			newProtocolVersion = string.Empty;


        }
		#endregion

		#region ComponentToChange
		/// <summary>
		/// Amendments have a list of Protocol components
		/// that are to be changed, some with an optional 
		/// description. So this object represents a component
		/// to be changed via an amendment
		/// </summary>
		public class ComponentToChange
		{
			public ComponentToChange ()
			{
				component = string.Empty;
				description = string.Empty;
			}

			#region INstance Variables
			private string component;
			private string description;
			#endregion

			#region Properties
			/// <summary>
			/// The Rex name of the component to change 
			/// see tblListValues where sFieldName = 'sComponentToChange'
			/// </summary>
			public string Component
			{
				get { return component; }
				set { component = value; }
			}

			/// <summary>
			/// The optional description of the component to change.
			/// </summary>
			public string Description
			{
				get { return description; }
				set { description = value; }
			}
			#endregion
		}

		#endregion

		#region RexDrug
		public class RexDrug
		{
			public RexDrug ( )
			{ 
				fDAStatus		= string.Empty;
				studyPhase		= string.Empty;
				sponsorOfIND	= string.Empty;
				indNumber		= string.Empty;
				dispensing		= string.Empty;
				dispensingOther = string.Empty;
			}

			#region instanceVars
			private string drugName;
			private string studyPhase;
			private string fDAStatus;
			private string indNumber;
			private string sponsorOfIND;
			private int    externalId;
			private string dispensing;
			private string dispensingOther;
			#endregion

			#region Properties
			/// <summary>
			/// Name of the drug
			/// </summary>
			public string DrugName
			{
				get { return drugName; }
				set { drugName = value; }
			}

			/// <summary>
			/// Phase of study the drug is in
			/// </summary>
			public string StudyPhase
			{
				get { return studyPhase; }
				set { studyPhase = value; }
			}

			/// <summary>
			/// FDA status of the drug.
			/// </summary>
			public string FDAStatus
			{
				get { return fDAStatus; }
				set { fDAStatus = value; }
			}

			/// <summary>
			/// Investigational drug number
			/// </summary>
			public string IndNumber
			{
				get { return indNumber; } 
				set { indNumber = value; }
			}

			/// <summary>
			/// wherer the drug will be dispensed.
			/// </summary>
			public string Dispensing
			{
				get { return dispensing; }
				set { dispensing = value; }
			}

			/// <summary>
			/// If other is selected in dispensing, the description of that.
			/// </summary>
			public string DispensingOther
			{
				get { return dispensingOther; }
				set { dispensingOther = value; }
			}
			
			/// <summary>
			/// Investigational drug Sponsor
			/// </summary>
			public string SponsorOfIND
			{
				get { return sponsorOfIND; }
				set { sponsorOfIND = value; }
			}

			/// <summary>
			/// Optional External ID from another system (ex. Rex)
			/// </summary>
			public int ExternalId
			{
				get { return externalId; }
				set { externalId = value; }
			}
			#endregion
		}
		#endregion

		#region RexDevice
		/// <summary>
		/// Class representing the Device information needed in Rex.
		/// </summary>
		public class RexDevice
		{
			public RexDevice() 
			{
				nonSigRisk	= string.Empty;
				fdaStatus	= string.Empty;
				ideNumber	= string.Empty;
				sponsorOfIDE= string.Empty;
			}
	
			#region instanceVars
			private string deviceName;
			private string nonSigRisk;
			private string fdaStatus;
			private string ideNumber;
			private string sponsorOfIDE;
			private int    externalId;
			#endregion

			#region Properties
			/// <summary>
			/// Name of the device
			/// </summary>
			public string DeviceName
			{
				get { return deviceName; }
				set { deviceName = value; }
			}

			/// <summary>
			/// whether the device has risk ornot
			/// </summary>
			public string NonSigRisk
			{
				get { return nonSigRisk; }
				set { nonSigRisk = value; }
			}

			/// <summary>
			/// FDA Status of the device.
			/// </summary>
			public string FDAStatus
			{
				get { return fdaStatus; }
				set { fdaStatus = value; }
			}

			/// <summary>
			/// The investigational device number
			/// </summary>
			public string IdeNumber
			{
				get { return ideNumber; } 
				set { ideNumber = value; }
			}
			
			/// <summary>
			/// The Sponsor name of the IDE
			/// </summary>
			public string SponsorOfIDE
			{
				get { return sponsorOfIDE; }
				set { sponsorOfIDE = value; }
			}

			/// <summary>
			/// Optional External ID from another system (ex. Rex)
			/// </summary>
			public int ExternalId
			{
				get { return externalId; }
				set { externalId = value; }
			}
			#endregion
		}
		#endregion

		#region Remuneration
		/// <summary>
		/// Remuneration values
		/// </summary>
		public class RexRemuneration
		{
			public RexRemuneration() 
			{
				type = string.Empty;
				otherDescription = string.Empty;
				amount = string.Empty;
			}

			#region instance vars
			private string type;
			private string amount;
			private string otherDescription;
			#endregion

			#region Props
			/// <summary>
			/// The type of remuneration
			/// </summary>
			public string Type
			{
				get { return type; }
				set { type = value; }
			}

			/// <summary>
			/// the amount being reimbursed.
			/// </summary>
			public string Amount
			{
				get { return amount; }
				set { amount = value; }
			}

			
			/// <summary>
			/// If the drug type is Other, use this field to hold a description of it.
			/// </summary>
			public string OtherDescription
			{
				get { return otherDescription; }
				set { otherDescription = value; }
			}
			#endregion
		}
		#endregion

		#region Continuing Review
		// continuing Review
		/// <summary>
		/// The project status field on the CR
		/// </summary>
		public string CRProjectStatus
		{ 
			get { return crProjectStatus; }
			set { crProjectStatus = value; }
		}

		
		/// <summary>
		/// The date closed field on the CR
		/// </summary>
		public DateTime	CRDateClosed
		{
			get { return crDateClosed; }
			set { crDateClosed = value; }
		}

		/// <summary>
		/// The number of records to date field on the CR
		/// </summary>
		public int CRRecordsToDate
		{
			get { return crRecordsToDate; }
			set { crRecordsToDate = value; }
		}

		/// <summary>
		/// The number of Specimens to date field on the CR
		/// </summary>
		public int CRSpecimensToDate
		{
			get { return crSpecimensToDate; }
			set { crSpecimensToDate = value; }
		}

		#region CRRace class
		public class CRRace
		{
			public CRRace() 
			{
				race = string.Empty;
			}

			#region instance vars
			private string race;
			private int males;
			private int females;
			private int unknown;
			#endregion

			#region Public props
			/// <summary>
			/// The Race listed.
			/// </summary>
			public string Race
			{
				get { return race; }
				set { race = value; }
			}

			/// <summary>
			/// NUmber of Males
			/// </summary>
			public int Males
			{
				get { return males; }
				set { males = value; }
			}

			/// <summary>
			/// Number of females
			/// </summary>
			public int Females
			{
				get { return females; }
				set { females = value; }
			}

			/// <summary>
			/// Unknown number of people
			/// </summary>
			public int Unknown
			{
				get { return unknown; }
				set { unknown = value; }
			}
			#endregion
		}
		#endregion
		#endregion

		#region OtherEvent Stuff
		/// <summary>
		/// The event type of the other event.
		/// </summary>
		public string OEEventType
		{
			get { return oeEventType; }
			set { oeEventType = value; }
		}

		/// <summary>
		/// The description of the other event.
		/// </summary>
		public string OEDescription
		{
			get { return oeDescription; }
			set { oeDescription = value; }
		}
		#endregion

	}
	#endregion
}
